<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>

<%
	String token = (String)session.getAttribute("token");
%>
<html>
	<head>
		<title>Hello Channel World !</title>
		<script type="text/javascript" src="/_ah/channel/jsapi"></script>
	</head>
	
	<body>
	
	<script>
		channel = new goog.appengine.Channel('<%=token %>');
		socket = channel.open();
		socket.onpen = function() {
			alert('channel is opened.');
		}
		socket.onmessage=function(message) {
			alert('message');
		}
		
		socket.onerror=function(err) {
			alert('error');
		}
		
		socket.onclose = function() {
			alert('close');
		}
	</script>
	</body>
</html>